<template>
  <!-- 容器 -->
  <div ref="charts" class="charts"></div>
</template>

<script>
import * as echarts from 'echarts'

export default {
  name: 'ProgressCharts',
  mounted() {
    // 初始化echarts实例
    const LineEcharts = echarts.init(this.$refs.charts)
    LineEcharts.setOption({
      xAxis: {show: false, min: 0, max: 100},
      yAxis: {show: false, type: 'category'},
      // 系列
      series: [
        {
          type: 'bar',
          data: [78],
          color: 'yellowgreen',
          barWidth: 10,
          // 背景颜色设置
          showBackground: true,
          backgroundStyle: {
            color: '#eee'
          },
          // 文本设置
          label: {
            show: true,
            formatter: '|',
            position: 'right'
          }
        }
      ],
      // 布局
      grid: {
        left: 0,
        right: 0,
        top: 0,
        bottom: 0
      }
    })
  }
}
</script>

<style scoped>
.charts {
  width: 100%;
  height: 100%;
}
</style>
